import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/User.vue'
import view from "@element-plus/icons-vue/dist/es/view.mjs";
import Login from "@/views/Login";
import Layout from "@/layout/Layout"
import User from "@element-plus/icons/lib/User";

const routes = [
  {
    path: '/front',
    name: 'Front',
    component: () => import("@/views/front/Front"),
    redirect: '/front/home',
    children: [
      {
        path: 'home',
        name: 'FrontHome',
        component: () => import("@/views/front/Home")
      },
      {
        path: 'detail',
        name: 'Detail',
        component: () => import("@/views/front/Detail")
      },
      {
        path: 'cart',
        name: 'Cart',
        component: () => import("@/views/front/Cart")
      },
      {
        path: 'order',
        name: 'FrontOrder',
        component: () => import("@/views/front/Order")
      },
      {
        path: 'foods',
        name: 'Foods',
        component: () => import("@/views/front/Foods")
      },
      {
        path: 'person',
        name: 'FrontPerson',
        component: () => import("@/views/front/Person")
      },
      {
        path: 'vip',
        name: 'FrontVIP',
        component: () => import("@/views/front/VIP")
      },
    ]
  },
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/system-user',
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import("@/views/Home")
      },
        {
          path: 'system-user',
          name: 'user',
          component: () => import("@/views/User")
        },
      {
        path: 'system-frontUser',
        name: 'frontUser',
        component: () => import("@/views/FrontUser")
      },
      {
        path: 'food',
        name: 'Food',
        component: () => import("@/views/Food")
      },
      {
        path: 'person',
        name: 'Person',
        component: () => import("@/views/Person")
      },
      {
        path: 'FoodType',
        name: 'FoodType',
        component: () => import("@/views/FoodType")
      },
      {
        path: 'order',
        name: 'Order',
        component: () => import("@/views/Order")
      },
      {
        path: 'role',
        name: 'Role',
        component: () => import("@/views/Role")
      },
      {
        path: 'vip',
        name: 'Vip',
        component: () => import("@/views/VIP")
      },
    ]
  },

  {
    path: '/login',
    name: 'login',
    component: () => import("@/views/Login")
  },
  {
    path: '/register',
    name: 'register',
    component: () => import("@/views/Register")
  },

  {
    path: '/front/register',
    name: 'frontRegister',
    component: () => import("@/views/front/Register")
  },
  {
    path: '/front/login',
    name: 'frontLogin',
    component: () => import("@/views/front/Login")
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
